<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    #box{
      width: 200px;
      height: 200px;
      background-color: cyan;
      display: grid;
      /* align-items: center;
      justify-items: center; */
      /* 简写属性 */
      place-items:center;
    }
    .item{
      width: 100px;
      height: 100px;
      background-color: pink;
    }
  </style>
</head>
<body>
    <div id="box">
      <div class="item"></div>
    </div>
    <script>
      const data = {
        name:'ck',
        age:19
      }
      const str = 'my name is {{name}}, and i am {{age}} years old.'
      function template(str, data) {
        const reg = /\{\{[w+]\}\}/
        console.log(reg.test(str));
      }

      template(str,data)
    </script>
</body>
</html>